<template>
	<view class="content">
		<image src="../../static/weixin.png" @click="goLogin"></image>		
	</view>
</template>

<script>
	export default {
		data() {
			return {
				
			}
		},
		methods: {
			goLogin (){
				uni.getProvider({
				    service: 'oauth',
				    success: function (res) {
				        console.log(res.provider)
				        if (~res.provider.indexOf('weixin')) {
				            uni.login({
				                provider: 'weixin',
				                success: function (loginRes) {
				                   uni.getUserInfo({
				                         provider: 'weixin',
				                         success: function (infoRes) {
				                           console.log('用户昵称为：' + infoRes.userInfo.nickName);
										   uni.showToast({
										   	title:"恭喜你,登陆成功",
											icon:"none"
										   })
				                         }
				                       });
				                }
				            });
				        }
				    }
				});
			}	
		}
	}
</script>

<style>
	.content{
		 display: flex;
		 justify-content: center;
	}
	image{
		 width: 80rpx;
		 height: 80rpx;
		 margin-top:100rpx;
	}

</style>
